import pandas as pd
from datetime import datetime

# 创建一个示例DataFrame
data = {'date_str': ['2022-09-15', '2022-09-16', '2022-09-17'],
        'value': [10, 20, 30]}
df = pd.DataFrame(data)

# 将字符串日期列转换为数字格式
df['date_num'] = pd.to_datetime(df['date_str']).apply(lambda x: (x - datetime(1, 1, 1)).days)

print(df)
